package com.heima.Test6;

public class GoodsTest {
    public static void main(String[] args) {
    //创建一个数组
        Goods[] arr = new Goods[3];
        //创建三个商品对象对象
        Goods g1 = new Goods("001", "联想笔记本", 5999, 100);
        Goods g2 = new Goods("002", "苹果手机", 8999, 100);
        Goods g3 = new Goods("003", "华为手机", 5999, 100);

        //把商品添加到数组中
        arr[0] = g1;
        arr[1] = g2;
        arr[2] = g3;
        for (int i = 0; i < arr.length; i++) {
            //索引
            Goods good=arr[i];
            System.out.println(good.getId()+","+good.getName()+","+good.getPrice()+","+good.getCount());
        }

    }
}
